import pygame
#游戏窗口区域(矩形区域)
SCREEN_RECT = pygame.Rect(0, 0, 480, 700)
from game_items import *
from game_hud import *
from game_music import *
class Game(object):
    '''游戏类'''
    def __init__(self):
        # 游戏主窗口
        self.main_windown = pygame.display.set_mode(SCREEN_RECT.size)
        pygame.display.set_caption("飞机大战")
        # 游戏状态属性
        self.is_game_over = False     #游戏结束标记
        self.is_pause = False         #游戏暂停标记
    def reset_game(self):
        """重置游戏"""
        self.is_game_over = False     #游戏结束标记
        self.is_pause = False         #游戏暂停标记




    def event_handler(self):
        """事件监听
        :return: 如果监听到退出事件，返回True,否则返回False
        """
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                return True
            elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
                return True
        return False


    def start(self):
        """开始游戏"""
        clock = pygame.time.Clock()    #游戏时钟
        while True:
            if self.event_handler():     #事件监听
                return
            pygame.display.update()    #更新显示
            clock.tick(60)             #设置刷新帧率


if __name__ == '__main__':
    pygame.init()
    Game().start()
    pygame.quit()